/**
 * 
 */
package org.moofaces.renderers;

import java.io.IOException;

import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
import javax.faces.context.ResponseWriter;
import javax.faces.render.Renderer;

/**
 * @author elsag
 *
 */
public class DatePickerRenderer extends Renderer {
	@Override
    public void decode(FacesContext context, UIComponent component) {
        super.decode(context, component);
    }

    @Override
    public void encodeEnd(FacesContext context, UIComponent component) throws IOException {

         ResponseWriter writer = context.getResponseWriter();
         writer.startElement("script", component);
         writer.append("quì ci va il js");
         writer.endElement("script");
         writer.startElement("input", component);
         writer.writeAttribute("name", "date_toggler", "");
         writer.writeAttribute("type", "text", "");
         writer.writeAttribute("class", "date date_toggled", "");
         writer.writeAttribute("style", "display: inline; width: 6em", "");
         writer.endElement("input");
         writer.startElement("img", component);
         writer.writeAttribute("src", "css/datepicker/calendar.gif", "");
         writer.writeAttribute("class", "date_toggler", "");
         writer.writeAttribute("style", "position: relative; top: 3px; margin-left: 1px;", "");
         writer.endElement("img");

    }
}
